<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!--引入 element-ui 的样式，-->
    <link rel="stylesheet" href="/admin/plugin/element-ui/index.css">
    <!-- 必须先引入vue，  后使用element-ui -->
    <script type="text/javascript" src="/admin/js-css/js/vue.min.js"></script>
    <!-- 引入element 的组件库-->
    <script type="text/javascript" src="/admin/plugin/element-ui/index.js"></script>

    <script type="text/javascript" src="/admin/plugin/element-ui/httpVueLoader.js"></script>

    <!--引入layui组件-->
    <link rel="stylesheet" href="/admin/plugin/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css"  media="all">
    <script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>

    <script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/mx1.0.js?v=1.1"></script>

</head>
<body>
<div id="app">
    <div style="text-align: center">
        <div>{{expResult.a1}}  错误数量：{{expResult.a3}}</div>
        <div>{{expResult.a2}}</div>
    </div>

    <el-row>
        <el-upload
                :action="uploadAction"
                :headers="headers"
                :on-success="uploadSuccess" >
            <el-button size="small" type="primary">选择xls文件</el-button>
        </el-upload>
    </el-row>

    <el-row style="padding: 10px 10px;">
        <el-input  v-model="source_keycode" placeholder="请输入源数据的keycode" ></el-input>

        <el-checkbox v-model="checksetting.a1" >导入栏目</el-checkbox>
        <el-checkbox v-model="checksetting.a2" >导入字段信息</el-checkbox>
        <el-checkbox v-model="checksetting.a3" >导入录入自定义、查询自定义、列表自定义、排序自定义</el-checkbox>
        <el-checkbox v-model="checksetting.a4" >导入按钮</el-checkbox>

        <el-checkbox v-model="checksetting.a5">导入数据</el-checkbox>

        <el-checkbox v-model="checksetting.a6">导入数据字典</el-checkbox>
        <el-checkbox v-model="checksetting.a7">导入分组录入页面</el-checkbox>


        <el-checkbox v-model="checksetting.all" @change="settingAll" >全/返选</el-checkbox>

    </el-row>
</div>

<script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>
<script>

    var vm = new Vue({
        el: '#app',
        data: {
            headers:{token:localStorage.getItem("token")},
            uploadAction:wwwurl+"/admin/api/UploadController/elementUiUploadDopostFileUpload",
            treeData:["0000"],
            defaultProps: {
                children: 'children',
                label: 'title'
            },
            checksetting:{"all":true},
            //进度条
            expResult: {"a3":"0"},
            xlsPath:"",
            source_keycode:"",
        },
        created(){
            for(let a=1;a<=7;a++){
                Vue.set(this.checksetting,"a"+a,true);
            }
            // this.getData();
        },
        methods:{
            uploadSuccess(response, file, fileList){
                this.xlsPath = response.data.src;
            },
            formatProgress(p){
                return p+"%";
            },
            settingAll(){
                for(let a=1;a<=7;a++){
                    this.checksetting["a"+a] = this.checksetting.all;
                }
            },
            getCheckedKeys() {
                return this.$refs.tree.getCheckedKeys();
            },
            handleNodeClick(treeNode) {
            },
            async getProgress(){
                const res = await post("/admin/api/ColumnManagementController/GetImportProgress",{});
                this.expResult = res.data;
                if(this.expResult.a1 != "所有数据全部导入完成"){
                    this.getProgress();
                }

            },

        }
    });


    function getData(){
        let mapda = {checksetting:vm.checksetting,xlsPath:vm.xlsPath,source_keycode:vm.source_keycode};
        return mapda;
    }

</script>
</body>
</html>